function validate(nameid, valiID) {
	var obj = $(nameid).value;
	obj = obj.replace(/(^\s*)|(\s*$)/g, "");// 去掉前后空格
	if ("" == obj) {
		// 菜单名不能为空
		$(valiID).innerHTML = "\u83dc\u5355\u540d\u4e0d\u80fd\u4e3a\u7a7a";
		return false;
	} else {
		$(valiID).innerHTML = " ";
		return true;
	}
}
/**
 * 检验id是否存在
 * */
function check(menuid,resulID,url) {
	var obj = $(menuid).value;
	obj = obj.replace(/(^\s*)|(\s*$)/g, "");
	if(""==obj){
		$(resulID).innerHTML="\u4e0a\u7ea7\u83dc\u5355\u4e0d\u53ef\u4ee5\u4e3a\u7a7a"
			return false;
	}else{
		var resul = /^([0-9]\d*?)$/.test(obj);
        var result = /^([1-9]\d*?)$/.test(obj);
		if(resul==true){
			if(obj==0){
				$(resulID).innerHTML="";
				return true;
			}else {
				var result = /^([1-9]\d*?)$/.test(obj);
				 if(result==true){
					 var pars = Form.Element.serialize($(menuid));
						var myAjax = new Ajax.Request(url, {
							method :'post',
							parameters :pars,
							onComplete :showResponse,
							asynchronous : true
						});	
				 }else{
					 $(resulID).innerHTML ="\u4e0a\u7ea7\u83dc\u5355ID\u6ca1\u6709\u4ee50\u5f00\u5934\u7684\u6570\u5b57";
				    return false;
				 }	
			}
			
		}else{
			$(resulID).innerHTML = "\u4e0a\u7ea7\u83dc\u5355ID\u5fc5\u987b\u662f\u6570\u5b57";
			return false ;
		}
	}
}

function showResponse(originalRequest) {
	if(originalRequest.responseText=="true"){
		$('resultParentid').innerHTML ="";
		return true;
	}else{
		$('resultParentid').innerHTML ="上级菜单ID不存在";
		/**Field.focus($('resultParentid'));**/
		return  false;
	}
	
}
/**
*检验是否可以提交
**/
function isSubmit(nameid, valiID){
	
	var xObject = new Boolean(true);
	if (xObject == validate(nameid, valiID)) {
		return true;
	} else {
		return false;
	}
}


function ismesag(message) {

	if (!confirm(message)) {
		
		 if (window.event) //IE
            {
                event.returnValue = false;   //event.returnValue=false 效果相同.
            }
            else //Firefox
            {
                event.preventDefault();
            	
            }
	}	
}


function getJsonObject1(url){	
	  var myAjax = new Ajax.Request(
			  url,
			  {
				  method:'post',
				  asynchronous:true
			  });
	}
function  getTureUser(tureuserID){	
	$(tureuserID).className = ($(tureuserID).className.toLowerCase() == "expanded" ? "collapsed"
			: "expanded");
		return ;
}
function getTureUserName(id, name,resultValue,reusltID,divID){
	$(id).value=name;
	$(reusltID).value=resultValue;
}
/**
function isSubmit(){
	if(""==$('truename').value){
		$('adminUser.tureUser.id').value="-1"
	}
}
**/